package io.renren.modules.mybog.hander;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component  //添加到ioc容器
public class MyUserTime implements MetaObjectHandler {
    //插入填充
    @Override
    public void insertFill(MetaObject metaObject) {
        log.info("开始插入");
        this.setFieldValByName("createTime",new Date(),metaObject);
    }
   //修改填充
    @Override
    public void updateFill(MetaObject metaObject) {
        log.info("修改");
        this.setFieldValByName("updateTime",new Date(),metaObject);
    }


}
